//
//  BaseViewController.m
//  ProjectForCustomer
//
//  Created by 钟游 on 2019/8/25.
//  Copyright © 2019年 钟游. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
    [self.navigationItem setBackBarButtonItem:backItem];
    [self.view setBackgroundColor:[UIColor whiteColor]];
}

+(instancetype)allocWithZone:(struct _NSZone *)zone{
    BaseViewController * base =[super allocWithZone:zone];
    @weakify(base)
    [[base rac_signalForSelector:@selector(viewDidLoad)] subscribeNext:^(id x) {
        
        @strongify(base)
        [base zy_addSubviews];
        [base zy_bindViewModel];
    }];
    
    [[base rac_signalForSelector:@selector(viewWillAppear:)] subscribeNext:^(id x) {
        @strongify(base)
        [base zy_getNewData];
    }];
    return base;
}
-(instancetype)initWithViewModel:(id<ViewModelProtocol>)viewModel{
    self=[super init];
    if (self) {
        
    }
    return self;
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    if (!self.tabBarController.tabBar.hidden  ) {
        self.tabBarController.tabBar.hidden = YES;
    }
}
#pragma mark - 屏幕旋转
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    
    return UIInterfaceOrientationMaskPortrait;
}

- (BOOL)shouldAutorotate {
    
    return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    
    return UIInterfaceOrientationPortrait;
}

#pragma mark - RAC
/**
 *  添加控件
 */
- (void)yd_addSubviews {}

/**
 *  绑定
 */
- (void)yd_bindViewModel {}

/**
 *  设置navation
 */
- (void)yd_layoutNavigation {}

/**
 *  初次获取数据
 */
- (void)yd_getNewData {}



@end
